-----------------------------------------------------------------------------------------------------------
		Excercise: 2 SQL (Multi User Bookstore system)
------------------------------------------------------------------------------------------------------------

create table Customer (
	c_id	number(20)	PRIMARY KEY GENERATED BY DEFAULT ON NULL AS IDENTITY,
	c_name  varchar(100)	NOT NULL);


create table Books (
	isbn	varchar(10) 	PRIMARY KEY,
	title	varchar(200)    NOT NULL,
	price	number(10)	NOT NULL,
	rating  number(10)	DEFAULT 3	NOT NULL);  
 

create table Purchase (
	c_id	number(20)	NOT NULL,
	isbn	varchar(10)	NOT NULL,
	PRIMARY KEY (c_id, isbn),
    	FOREIGN KEY (isbn) REFERENCES Books(isbn) ON DELETE CASCADE,
    	FOREIGN KEY (c_id) REFERENCES Customer(c_id) ON DELETE CASCADE);

	
create table Books (
	isbn	varchar(10)	NOT NULL,
	rating	number(10)	NOT NULL,
	votes	number(10)	DEFAULT 1	NOT NULL);